﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Migrations
{
    /// <inheritdoc />
    public partial class add_table_stdphrdict : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_StdPhrDict_MainStdDomainDict_StdDomainDictId",
                table: "StdPhrDict");

            migrationBuilder.DropForeignKey(
                name: "FK_StdPhrDict_MainStdModelConfig_StdModelConfigId",
                table: "StdPhrDict");

            migrationBuilder.DropPrimaryKey(
                name: "PK_StdPhrDict",
                table: "StdPhrDict");

            migrationBuilder.RenameTable(
                name: "StdPhrDict",
                newName: "MainStdPhrDict");

            migrationBuilder.RenameIndex(
                name: "IX_StdPhrDict_StdModelConfigId",
                table: "MainStdPhrDict",
                newName: "IX_MainStdPhrDict_StdModelConfigId");

            migrationBuilder.RenameIndex(
                name: "IX_StdPhrDict_StdDomainDictId",
                table: "MainStdPhrDict",
                newName: "IX_MainStdPhrDict_StdDomainDictId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainStdPhrDict",
                table: "MainStdPhrDict",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MainStdPhrDict_MainStdDomainDict_StdDomainDictId",
                table: "MainStdPhrDict",
                column: "StdDomainDictId",
                principalTable: "MainStdDomainDict",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainStdPhrDict_MainStdModelConfig_StdModelConfigId",
                table: "MainStdPhrDict",
                column: "StdModelConfigId",
                principalTable: "MainStdModelConfig",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MainStdPhrDict_MainStdDomainDict_StdDomainDictId",
                table: "MainStdPhrDict");

            migrationBuilder.DropForeignKey(
                name: "FK_MainStdPhrDict_MainStdModelConfig_StdModelConfigId",
                table: "MainStdPhrDict");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainStdPhrDict",
                table: "MainStdPhrDict");

            migrationBuilder.RenameTable(
                name: "MainStdPhrDict",
                newName: "StdPhrDict");

            migrationBuilder.RenameIndex(
                name: "IX_MainStdPhrDict_StdModelConfigId",
                table: "StdPhrDict",
                newName: "IX_StdPhrDict_StdModelConfigId");

            migrationBuilder.RenameIndex(
                name: "IX_MainStdPhrDict_StdDomainDictId",
                table: "StdPhrDict",
                newName: "IX_StdPhrDict_StdDomainDictId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_StdPhrDict",
                table: "StdPhrDict",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_StdPhrDict_MainStdDomainDict_StdDomainDictId",
                table: "StdPhrDict",
                column: "StdDomainDictId",
                principalTable: "MainStdDomainDict",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_StdPhrDict_MainStdModelConfig_StdModelConfigId",
                table: "StdPhrDict",
                column: "StdModelConfigId",
                principalTable: "MainStdModelConfig",
                principalColumn: "Id");
        }
    }
}
